<?php
require 'include/global.php';
require_once 'include/train_db.php';
include("include/HOP.php");

$smarty->compile_check = true;
$utype = $_GET[utype];
$uname = $_GET[uname];
if(!empty($_SESSION[usertype])) $utype = $_SESSION[usertype];
if(!empty($_SESSION[uname])) $uname = $_SESSION[uname];

if($utype=='employer'){
 $itemname = "Employer";
 $pay = "39.95";
 $title    = "Employer membership fee is $39.95 per month after trial. To purchase a membership please click on the 'Buy Now' button below. <br /><br />
			We currently accept VISA, MasterCard, American Express, and Discover Card. Your credit card payment will be processed directly through Bank of America and Cybersource's Secure Online System. Please have your credit card ready before continuing.<br />";
 $sql = "SELECT * FROM pa_employer WHERE ep_uname = '".$uname."'";
 $rss =  $DB->fetch_one_array($sql);
 $firstname = $rss[ep_fname];
 $lastname  = $rss[ep_lname];
 $location  = $rss[ep_address1];
 $city      = $rss[ep_city];
 $state     = $state[$rss[ep_state]];
 $zip       = $rss[ep_zip];
 $country   = "US";
 $phone     = $rss[ep_phone];
 $email     = $rss[ep_email];
 $comments  = "Employer membership"  ;
 $myfield   = $rss[ep_id]."|employer";
 $toptitle  = "Checkout";
}
if($utype=='recruiter'){
 $itemname = "Recruiter";
 $pay = "29.95";
 //$title = "Recruiter $19.95/month 90 days free";
 $title = "If you wish to apply for our Premium membership please send us an email. A representative will contact you shortly after we receive your email. Please send your email to: <a href=\"mailto:premium@enetrecruiter.com\">premium@enetrecruiter.com</a>.";


 $sql = "SELECT * FROM pa_recuiter WHERE rc_uname = '".$uname."'";
 $rss =  $DB->fetch_one_array($sql);
 $firstname = $rss[rc_fname];
 $lastname  = $rss[rc_lname];
 $location  = $rss[rc_address1];
 $city      = $rss[rc_city];
 $state     = $state[$rss[rc_state]];
 $zip       = $rss[rc_zip];
 $country   = "US";
 $phone     = $rss[rc_phone];
 $email     = $rss[rc_email];
 $comments  = "Recruiter membership"  ;
 $myfield   = $rss[rc_id]."|recruiter";
 $toptitle  = "Membership Purchase";
}

if($utype=='candidate'){
 $itemname = "Candidate";
 $pay      = "2.75";
 $title    = "Your account status is currently active.  You do not need to purchase a membership.";
 $sql      = "SELECT * FROM pa_candidates WHERE js_uname = '".$uname."'";
 $rss      =  $DB->fetch_one_array($sql);
 $firstname = $rss[js_fname];
 $lastname  = $rss[js_lname];
 $location  = $rss[js_address1];
 $city      = $rss[js_city];
 $zip       = $rss[js_zip];
 $state     = $state[$rss[js_state]];
 $country   = "US";
 $phone     = $rss[js_phone];
 $email     = $rss[js_email];
 $comments  = "Candidate membership"  ;
 $myfield   = $rss[js_id]."|candidate";
 $toptitle  = "Checkout";
}

if($utype=='advisor'){
 $itemname = "Advisor";
 $pay      = "11.95";
 $title    = "Advisor membership fee is $11.95 per month after trial. To purchase a membership please click on the 'Buy Now' button below.<br /><br />We currently accept VISA, MasterCard, American Express, and Discover Card. Your credit card payment will be processed directly through Bank of America and Cybersource's Secure Online System. Please have your credit card ready before continuing. <br /><br />";
 $sql      = "SELECT * FROM pa_advisory  WHERE ad_uname = '".$uname."'";
 $rss      =  $DB->fetch_one_array($sql);
 $firstname = $rss[ad_fname];
 $lastname  = $rss[ad_lname];
 $location  = $rss[ad_address];
 $city      = $rss[ad_city];
 $zip       = $rss[ad_zip];
 $state     = $state[$rss[ad_state]];
 $country   = "US";
 $phone     = $rss[ad_phone];
 $email     = $rss[ad_email];
 $comments  = "Advisor membership"  ;
 $myfield   = $rss[ad_id]."|advisor";
 $toptitle  = "Membership Purchase";
}

$overdue = (!empty($_SESSION['status']))?$_SESSION['status']:"Trial";

if($overdue=="Trial"){
   $overduemessage = "";
}

if($overdue=="Expired"&&$_SESSION[usertype]!='recruiter'){
	$overduemessage = "Your account is now expired. ";
	$title			= "Please contact us to reactivate your account or reapply for a membership. Please send your email to: <a href=\"mailto:support@enetrecruiter.com\">support@enetrecruiter.com</a>. ";
}

if($overdue == "Expired"&&$_SESSION[usertype]=="candidate"){
	$overduemessage = "Your current account status is <b>Expired</b>!";
	$title = "Please contact us to activate your account.  Thank you. ";
}

$smarty->assign("firstname",$firstname);
$smarty->assign("lastname",$lastname);
$smarty->assign("location",$location);
$smarty->assign("city",$city);
$smarty->assign("state",$state);
$smarty->assign("country",$country);
$smarty->assign("zip",$zip);
$smarty->assign("phone",$phone);
$smarty->assign("email",$email);
$smarty->assign("cbk",InsertSignature3("$pay","USD","subscription"));
$smarty->assign("subscription",InsertSubscriptionSignature($pay, 
    date('Ymd'), 
    'monthly', 
    '0',
    'true'));
$smarty->assign("title",$title);
$smarty->assign("toptitle",$toptitle);
$smarty->assign("comments",$comments);
$smarty->assign("myfield",$myfield);
$smarty->assign("overdue",$overdue);
$smarty->assign("overduemessage",$overduemessage);


$smarty->display('header.tpl');
$smarty->display('left.tpl');
$smarty->display('cybersource.tpl');
$smarty->display('right.tpl');
$smarty->display('footer.tpl');
?>
